package com.community.body.service.impl;

import java.util.List;

import com.community.body.domain.ZyOwnerRoomRecord;
import com.community.body.dto.RecordDTO;
import com.community.body.mapper.ZyOwnerRoomMapper;
import com.community.body.mapper.ZyOwnerRoomRecordMapper;
import com.community.body.service.IZyOwnerRoomRecordService;
import com.community.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 房屋绑定记录 Service业务层处理
 * 
 * @author community
 * @date 2024-04-12
 */
@Service
public class ZyOwnerRoomRecordServiceImpl implements IZyOwnerRoomRecordService
{
    @Resource
    private ZyOwnerRoomRecordMapper zyOwnerRoomRecordMapper;

    @Resource
    private ZyOwnerRoomMapper zyOwnerRoomMapper;

    /**
     * 查询房屋绑定记录 
     * 
     * @param recordId 房屋绑定记录 主键
     * @return 房屋绑定记录 
     */
    @Override
    public ZyOwnerRoomRecord selectZyOwnerRoomRecordByRecordId(Long recordId)
    {
        return zyOwnerRoomRecordMapper.selectZyOwnerRoomRecordByRecordId(recordId);
    }

    /**
     * 查询房屋绑定记录 列表
     * 
     * @param zyOwnerRoomRecord 房屋绑定记录 
     * @return 房屋绑定记录 
     */
    @Override
    public List<RecordDTO> selectZyOwnerRoomRecordList(ZyOwnerRoomRecord zyOwnerRoomRecord)
    {
        return zyOwnerRoomRecordMapper.selectZyOwnerRoomRecordList(zyOwnerRoomRecord);
    }

    /**
     * 新增房屋绑定记录 
     * 
     * @param zyOwnerRoomRecord 房屋绑定记录 
     * @return 结果
     */
    @Override
    public int insertZyOwnerRoomRecord(ZyOwnerRoomRecord zyOwnerRoomRecord)
    {
        zyOwnerRoomRecord.setUpdateTime(DateUtils.getNowDate());
        zyOwnerRoomMapper.updateZyOwnerRoom1(zyOwnerRoomRecord);
        return zyOwnerRoomRecordMapper.insertZyOwnerRoomRecord(zyOwnerRoomRecord);
    }

    @Override
    public int insertZyOwnerRoomRecord1(ZyOwnerRoomRecord zyOwnerRoomRecord) {
        zyOwnerRoomRecord.setCreateTime(DateUtils.getNowDate());
        zyOwnerRoomMapper.insertZyOwnerRoom1(zyOwnerRoomRecord);
        Long aLong = zyOwnerRoomMapper.selectZyOwnerRoomOne(zyOwnerRoomRecord);
        zyOwnerRoomRecord.setOwnerRoomId(String.valueOf(aLong));
        return zyOwnerRoomRecordMapper.insertZyOwnerRoomRecord(zyOwnerRoomRecord);
    }

    /**
     * 修改房屋绑定记录 
     * 
     * @param zyOwnerRoomRecord 房屋绑定记录 
     * @return 结果
     */
    @Override
    public int updateZyOwnerRoomRecord(ZyOwnerRoomRecord zyOwnerRoomRecord)
    {
        zyOwnerRoomRecord.setUpdateTime(DateUtils.getNowDate());
        return zyOwnerRoomRecordMapper.updateZyOwnerRoomRecord(zyOwnerRoomRecord);
    }

    /**
     * 批量删除房屋绑定记录 
     * 
     * @param recordIds 需要删除的房屋绑定记录 主键
     * @return 结果
     */
    @Override
    public int deleteZyOwnerRoomRecordByRecordIds(Long[] recordIds)
    {
        return zyOwnerRoomRecordMapper.deleteZyOwnerRoomRecordByRecordIds(recordIds);
    }

    /**
     * 删除房屋绑定记录 信息
     * 
     * @param recordId 房屋绑定记录 主键
     * @return 结果
     */
    @Override
    public int deleteZyOwnerRoomRecordByRecordId(Long recordId)
    {
        return zyOwnerRoomRecordMapper.deleteZyOwnerRoomRecordByRecordId(recordId);
    }


}
